package com.qk.controller;

import com.qk.commen.Result;
import com.qk.entity.User;
import com.qk.service.UserService;
import com.qk.vo.LoginResultVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * user login controller
 */
@Slf4j
@RestController

public class LoginController {
    @Autowired
    private UserService userService;

    @PostMapping ("/login")
   public Result login(@RequestBody User user){
        log.info("用户登录: {}", user);
      LoginResultVo loginResultVo = userService.login(user);
        return Result.success(loginResultVo);
    }
}
